######        texture_path=str("../Graphics/Textures/"+texture+".png")
######        texture = Image.open(texture_path)
######        texture = texture.convert("RGB")
######
######        outline_path=str("../Graphics/Sprites/Mecha/Weapon/"+outline+".png")
######
######        for y in xrange(texture.size[1]):
######        for x in xrange(texture.size[0]):
######            if pixdata[x, y] == (0,183,239,255):
######                pixdata[x, y] = (0,0,0,0)
######                i+=1
from PIL import Image

def get_pixel(r=0,g=0,b=0,a="null",img_path="null"):
    if img_path == "null":
        print "bad img_path"
        return

    texture = Image.open(img_path)
    if a == "null":
        texture = texture.convert("RGBA")
        search=r,g,b,a
    else:
        texture = texture.convert("RGB")
        search=r,g,b
    pixdata = texture.load()
    return_list=[]
    for y in xrange(texture.size[1]):
        for x in xrange(texture.size[0]):
            if pixdata[x, y] == search:
                return_list.append((x,y))
    return return_list

                
        
                 ##this will scan through each item in the slots section and can be used to get stats from it
        ##USE this to assemble mecha-pictures
#for list in read_schema("sidnam","slots","2",1):
#	read_schema("sidnam","slots",list)

######USE THIS IN COMBINATION WITH A VARIATION OF THE BACKROUND-TO-ALPHA CODE
######TO GET x,y COORDINATES OF MUZZLE, ORIGIN AND SMOKE-POINT

####added variable sprites to root files: and figured out a method to automatically
####determine origin locations on weapon sprites
####- orange = origin (255,126,0,255 replace with alpha-orange(255,126,0,0))
####- green = muzzle_point (34,177,76,255, replace with black (0,0,0,255))
####- pink = smoke_point (255,163,177,255 replace with black (0,0,0,255))(if not
####found, same as muzzle point - else spawn smoke on fire)
